{extend name="public/base" /}
{block name="css"}
{load href="https://ujia-res.oss-cn-shenzhen.aliyuncs.com/common/third-party/swiper/5.0.3/dist/swiper.min.css" /}
<style>
  .main-container {
    position: relative;
    z-index: 1;
  }

  .single-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .multi-3-text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .item {
    display: flex;
    justify-content: space-between;
    overflow: hidden;
    background: #ffffff;
    padding: 0 40px;
  }


  .item > .cover {
    width: 160px;
    height: 160px;
    flex: .35;
    min-width: 160px;
  }

  .item > .content {
    display: flex;
    flex: 1;
    padding: 0 0 0 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .content > .title {
    font-size: 19px;
    color: #333333;
    font-weight: 400;
  }

  .title:hover {
    color: #884233;
  }

  .content > .summary {
    color: #999999;
    letter-spacing: 2px;
  }

  .content > .footer {
    display: flex;
    justify-content: space-between;
  }

  .content > .footer > div {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .content > .footer > div > img {
    width: 22px;
    vertical-align: center;
  }

  .content > .footer > div > span {
    font-size: 14px;
    color: #333333;
  }

  .content > .footer > a {
    border: 1px #666 solid;
    padding: 5px 20px;
    color: #666;
    cursor: pointer;
  }

  .content > .footer > a:hover {
    border: 1px #884233 solid;
    color: #884233;
  }

  .pagination {
    margin: 0 !important;
  }

  .pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover {
    z-index: 3;
    color: #fff;
    cursor: default;
    background-color: #884233;
    border-color: #884233;
  }

  .pagination>li>a, .pagination>li>span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    color: #884233;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
  }

  .newest {
    display: flex;flex-direction: column;
  }

  .newest > a {
    line-height: 35px;
    color: #555;
    font-size: 16px;
  }

  .newest > a:hover {
    color:#884233;
  }

  .form-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
  }

  .form-item > span {
   font-size: 15px;
  }

  .form-item > input {
    border-radius: 3px;
    font-size: 15px;
    width: 210px;
  }


  select {
    padding-right: 0 !important;
  }

  .submit {
    margin: 0 auto;
    width: 200px;
    height: 35px;
    border-radius:4px;
    border: 0;
    background: #884233;
    color: #FFFFFF;
  }

</style>
{/block}
{block name="main"}
<section class="container-fluid main-container">
  <!-- banner -->
  <div class="row" style="position: relative">
    <img alt="" style="width: 100vw" class="img-responsive" src="https://res.bestyoujia.com/web/UJGC/static/banner_gsdt.png">
  </div>
  <!-- banner end -->

  <div class="row" style="width: 1200px;margin: 0 auto;position: relative">
    <div style="width: 1200px;margin: 50px 0;display: flex;flex-wrap: nowrap;position: relative">
      <div style="border: 1px #CCCCCC solid;width: 840px;padding: 40px 0">
        {volist name="list" id="v"}
        <div class="item">
          <a href="{$Request.root}/article/{$v.id}.html" class="cover" style="background: url('{$v.cover}'); background-size: cover;">
            &nbsp;</a>
          <div class="content">
            <a href="{$Request.root}/article/{$v.id}.html" class="title">{$v.title}</a>
            <div class="summary multi-3-text">
              {$v.summary}
            </div>
            <div class="footer">
              <div>
                <span style="background: #884233;border-radius:12px;font-size: 14px;padding: 0px 6px;color: #FFFFFF">{$v.tag}</span>
              </div>
              <span style="color:#666666">发布时间：{$v.create_time}</span>
            </div>
          </div>
        </div>
        <hr style="margin: 30px 40px">
        {/volist}
        <nav style="text-align: center">
          {$list}
        </nav>
      </div>
      <div data-sticky-container id="side-order" style="width: 340px;margin-left: 20px;background: #FFFFFF">
        <div  data-sticky data-margin-top="50" style="border: 1px #CCCCCC solid;padding: 20px;">
          <div style="color: #884233;font-size: 19px;font-weight: 400">提前算一算，我家装修需要多少钱</div>
          <hr>
          <div class="newest">
            <div class="form-item">
              <span>*房屋类型：</span>
              <select id="house_type" style="font-size: 15px;width: 210px;height:30px;border: 1px #CCCCCC solid;border-radius: 3px;">
                <option value="">请选择房屋类型</option>
                <option value="清水房/毛坯房">清水房/毛坯房</option>
                <option value="精装房">精装房</option>
                <option value="旧房/二手房">旧房/二手房</option>
              </select>
            </div>
            <div class="form-item">
              <span>*房屋户型：</span>
              <input id="housing" style="height:30px;border: 1px #CCCCCC solid" />
            </div>
            <div class="form-item">
              <span>*建筑面积：</span>
              <input id="area" type="number" style="height:30px;border: 1px #CCCCCC solid" />
            </div>
            <div class="form-item">
              <span>*手机号码：</span>
              <input id="mobile" type="tel" style="height:30px;border: 1px #CCCCCC solid" />
            </div>
            <div style="margin: 10px 0 20px;text-align: center;color: #999999;font-size: 13px">*为了您的权益，您的隐私将被严格保密</div>
            <button class="submit">立即计算</button>
          </div>
        </div>
      </div>
    </div>
  </div>

</section>
{/block}
{block name="js"}
{load href="https://res.bestyoujia.com/common/third/sticky.compile.js" /}
<script>
  $('.navbar-nav').children('li').eq(9).addClass('nav-active');

  const sticky = new Sticky('[data-sticky]');

  $('.submit').click(function() {
    window.page_position = '公司动态';
    const mobile = $('#mobile').val();
    const area = $('#area').val();
    const housing = $('#housing').val();
    const house_type = $('#house_type').val();

    if(!house_type) {
      showWarnTips('请选择房屋类型', '#house_type');
      return;
    }
    if(!housing) {
      showWarnTips('请填写房屋户型', '#housing');
      return;
    }
    if(!area) {
      showWarnTips('请填写建筑面积', '#area');
      return;
    }

    switch (validMobile(mobile)) {
      case 0:
        showWarnTips('手机号格式不正确', '#mobile');
        break;
      case 1:

        const data = { mobile, area, housing, customer: $('#home-username').val(), house_type };
        doAppointment(data,
          function(res) {
            console.log('onAppointmentSuccess', res);
            const { data = '' } = res;
            if(data) {
              buryingPoint('APPOINTMENT', data);
              layer.msg('预约成功，我们将在2小时内联系您', {
                icon: 6,
                time: 1200
              });
              $('#mobile').val('');
              $('#area').val('');
              $('#house_type').val('');
              $('#housing').val('');
            }
          }, function(err) {
            console.log('onAppointmentError', err);
            $('#mobile').val('');
            $('#area').val('');
            $('#house_type').val('');
            $('#housing').val('');
            alert('出错啦，欢迎致电400-6166-002');
          });
        break;
      case 2:
        showWarnTips('请输入手机号', '#mobile');
        break;
      default:
        break;
    }
  });

  function showWarnTips(msg, dom) {
    layer.tips(msg, dom, {
      tips: [1, '#fa8c16'],
      time: 2000
    });
  }
</script>
{/block}